package cn.edu.hqu.experiment2.Service;

import cn.edu.hqu.experiment2.DAO.OrderMapper;
import cn.edu.hqu.experiment2.Entities.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

@Service
public class OrderService {
    @Autowired
    private OrderMapper orderMapper;

    public void insertOrder(Order order) {
        orderMapper.insertOrder(order);
    }

    public void updateOrder(Order order) {
        orderMapper.updateOrder(order);
    }

    public Order getOrderById(int id) {
        return ResponseEntity.ok(orderMapper.getOrderById(id)).getBody();
    }
}
